/********************************************************************************
 * Project Name		[JavaSE_Fundamentals]
 * File Name     	[VariablesInitialization.java]
 * Creation Date 	[2015-01-01]
 * 
 * Copyright© ge.y.yang@gmail.com All Rights Reserved
 * 
 * Work hard, play harder, think big and keep fit
 ********************************************************************************/
package basicGrammar;

/**
 * 变量初始化<br/>
 * 
 * 成员变量[定义在类中的变量]初始化<br/>
 * byte[0], short[0], int[0], long[0], float[0.0], double[0.0], char['\u0000],
 * boolean[false]<br/>
 * 引用类型[null]<br/>
 * 
 * 局部变量[定义在方法中的变量]初始化<br/>
 * 局部变量必须显式初始化, 否则编译会出错<br/>
 * 局部变量只能在该方法体内使用, 不能跨方法访问<br/>
 * 可在不同的方法中声明同名的局部变量<br/>
 * 
 * @author 不落的太阳(Sean Yang aka ShortPeace)
 * @version 1.0
 * @since jdk 1.8
 * 
 */
public class VariablesInitialization {

	byte byteType;
	short shortType;
	int intType;
	long longType;

	float floatType;
	double doubleType;

	char charType;

	boolean booleanType;

	String string;

	public void printInitializedValue() {
		System.out.println("default byteType value = " + byteType); // 0
		System.out.println("default shortType value = " + shortType); // 0
		System.out.println("default intType value = " + intType); // 0
		System.out.println("default longType value = " + longType); // 0
		System.out.println("default floatType value = " + floatType); // 0.0
		System.out.println("default doubleType value = " + doubleType); // 0.0
		System.out.println("default charType value = " + charType); // \u0000
		System.out.println("default booleanType value = " + booleanType); // false
		System.out.println("default referenceType value = " + string);

		int localIntType = 0;
		System.out.println("local variable = " + localIntType);
	}

	public static void main(String[] args) {
		new VariablesInitialization().printInitializedValue();
	}
}
